From f3af88d34b40f1a73b30eec1409892b570abaa31 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Sun, 8 Nov 2009 16:17:13 +0000 Subject: [PATCH] * localized and fixed height for video player interface --- js2/mwEmbed/php/noMediaWikiConfig.php | 10 +++--- js2/remoteMwEmbed.js | 51 ++++++++++++++++++++------- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/js2/mwEmbed/php/noMediaWikiConfig.php b/js2/mwEmbed/php/noMediaWikiConfig.php index 55dd0ebfe5..a18aaf405f 100644 --- a/js2/mwEmbed/php/noMediaWikiConfig.php +++ b/js2/mwEmbed/php/noMediaWikiConfig.php @@ -74,13 +74,15 @@ function wfMkdirParents( $dir, $mode = null, $caller = null ) { return @mkdir( $dir, $mode, true ); // PHP5 <3 } -function wfMsgGetKey( $msgKey ) { +function wfMsgGetKey( $msgKey, $na, $langKey=false ) { global $messages, $mwLanguageCode; + if(!$langKey){ + $langKey = $mwLanguageCode; + } // Make sure we have the messages file: require_once( realpath( dirname( __FILE__ ) ) . '/languages/mwEmbed.i18n.php' ); - - if ( isset( $messages[$mwLanguageCode] ) && isset( $messages[$mwLanguageCode][$msgKey] ) ) { - return $messages[$mwLanguageCode][$msgKey]; + if ( isset( $messages[$mwLanguageCode] ) && isset( $messages[$langKey][$msgKey] ) ) { + return $messages[$langKey][$msgKey]; } else { return '<' . $msgKey . '>'; } diff --git a/js2/remoteMwEmbed.js b/js2/remoteMwEmbed.js index e507288826..78b473c6cf 100644 --- a/js2/remoteMwEmbed.js +++ b/js2/remoteMwEmbed.js @@ -2,9 +2,21 @@ * this file exposes some of the functionality of mwEmbed to wikis * that do not yet have js2 enabled */ + var urlparts = getRemoteEmbedPath(); var mwEmbedHostPath = urlparts[0]; -var reqAguments = urlparts[1]; +var mwRemoteVersion = 58776; + +reqArguments = urlparts[1]; + +//setup up request Params: +var reqParts = urlparts[1].split('&'); +var reqParam={}; +for(var i=0;i< reqParts.length; i++){ + var p = reqParts[i].split('='); + if( p.length == 2 ) + reqParam[ p[0] ]= p[1]; +} addOnloadHook( function(){ //only do rewrites if MV_EMBED / js2 is "off" @@ -17,22 +29,21 @@ function doPageSpecificRewrite() { // Add media wizard if( wgAction == 'edit' || wgAction == 'submit' ) { load_mv_embed( function() { - loadExternalJs( mwEmbedHostPath + '/editPage.js' + reqAguments ); + loadExternalJs( mwEmbedHostPath + '/editPage.js' + reqArguments ); } ); } - //timed text dispaly: + //timed text display: if(wgPageName.indexOf("TimedText") === 0){ load_mv_embed(function(){ - alert('wtf'); - loadExternalJs( mwEmbedHostPath + '/mwEmbed/libTimedText/mvTimeTextEdit.js' + reqAguments ); + loadExternalJs( mwEmbedHostPath + '/mwEmbed/libTimedText/mvTimeTextEdit.js' + reqArguments ); }); } // Firefogg integration if( wgPageName == "Special:Upload" ){ load_mv_embed( function() { - loadExternalJs( mwEmbedHostPath + '/uploadPage.js' + reqAguments ); + loadExternalJs( mwEmbedHostPath + '/uploadPage.js' + reqArguments ); } ); } @@ -41,7 +52,7 @@ function doPageSpecificRewrite() { var wgEnableIframeApiProxy = true; load_mv_embed( function() { js_log("Wiki:ApiProxy::"); - loadExternalJs( mwEmbedHostPath + '/apiProxyPage.js' + reqAguments ); + loadExternalJs( mwEmbedHostPath + '/apiProxyPage.js' + reqArguments ); }); } @@ -74,8 +85,7 @@ function rewrite_for_OggHandler( vidIdList ){ var pimg = $j( '#' + vidId + ' img' ); var poster_attr = 'poster = "' + pimg.attr( 'src' ) + '" '; var pwidth = $j( '#' + vidId).width(); - var pheight = $j( '#' + vidId ).height(); - + var pheight = $j( '#' + vidId + ' img').height(); var tag_type = 'video'; // Check for audio @@ -156,9 +166,24 @@ function getRemoteEmbedPath() { function load_mv_embed( callback ) { // Inject mv_embed if needed - if( typeof $mw == 'undefined' ) { - var mvurl = mwEmbedHostPath + '/mwEmbed/mv_embed.js' + reqAguments ; - importScriptURI( mvurl ); + if( typeof $mw == 'undefined' ) { + if( reqParam['uselang'] || reqParam['useloader'] ){ + var rurl = mwEmbedHostPath + '/mwEmbed/jsScriptLoader.php?class=mv_embed'; + if(typeof window.jQuery == 'undefined'){ + rurl+= ',window.jQuery'; + } + if(reqParam['urid']){ + rurl+='&urid=' + reqParam['urid']; + }else{ + rurl+='&urid=' + mwRemoteVersion; + } + if(reqParam['uselang'] ) + rurl+='&uselang=' + reqParam['uselang']; + //do import url: + importScriptURI(rurl); + }else{ + importScriptURI( mwEmbedHostPath + '/mwEmbed/mv_embed.js' + reqArguments ); + } } check_for_mv_embed( callback ); } @@ -171,4 +196,4 @@ function check_for_mv_embed( callback ) { } else { callback(); } -} +} \ No newline at end of file -- 2.20.1